package SV_LDAP;

public class Example {
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        try {
            String filter = req.getParameter("filter");
            NamingEnumeration<SearchResult> namingEnumeration = context.search(name, filter, null);

            while (namingEnumeration.hasMore()) {
                SearchResult searchResult = namingEnumeration.next();
                Attribute attribute = searchResult.getAttributes().get("");
                if (ATTRIBUTE_TYPE.equals(attribute.getID())) {
                    resp.getOutputStream().println(attribute.get() + ";");
                }

            }
        } catch (NamingException e) {
            throw new ServletException("LDAP failure", e);
        }
    }
}
